<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;

class CreateStoresTable extends Migration {

	/**
	 * Run the migrations.
	 *
	 * @return void
	 */
	public function up()
	{
		Schema::create('stores', function(Blueprint $table)
		{
			$table->increments('id');
			$table->integer('customer_id')->comment('所属代理customer表 的 id');
			$table->integer('youzan_authorizer_id')->default(0)->comment('对应有赞youzan_authorizers的id');
			$table->string('name')->default('')->comment('店铺名称');
			$table->string('email', 40)->default('')->comment('登录用邮箱');
			$table->string('address')->default('')->comment('联系地址');
			$table->string('longitude')->default('')->comment('经度');
			$table->string('latitude')->default('')->comment('纬度');
			$table->string('phone', 100)->default('')->comment('联系电话');
			$table->boolean('type')->comment('类型 1 总店 2 分店');
			$table->string('store_img')->nullable()->comment('店铺头像');
			$table->string('remark')->nullable()->comment('备注');
			$table->boolean('has_youzan')->default(0)->comment('是否有有赞商城');
			$table->integer('visit')->unsigned()->default(0)->comment('店铺访问量 用户登录时计');
			$table->boolean('is_deleted')->default(0)->comment('是否启用或者禁用，0：启用，1：禁用');
			$table->timestamps();
			$table->string('province')->nullable();
			$table->string('city')->nullable();
			$table->string('district')->nullable();
		});
	}


	/**
	 * Reverse the migrations.
	 *
	 * @return void
	 */
	public function down()
	{
		Schema::drop('stores');
	}

}
